package com.da.javatest.niuke.jianzhi;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2020/10/26 11:26
 * https://www.nowcoder.com/practice/94a4d381a68b47b7a8bed86f2975db46?
 * tpId=13&tags=&title=&diffculty=0&judgeStatus=0&rp=1
 */
public class C51Solution {
    public static int[] multiply(int[] A) {
        int[] B = new int[A.length];
        int temp;
        for (int i = 0; i < A.length; i++) {
            temp = A[i];
            A[i] = 1;
            B[i] = 1;
            for (int data : A) {
                B[i] *= data;
            }
            A[i] = temp;
        }
        return B;
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(multiply(new int[] {1, 2, 3, 4, 5, 6, 7})));
    }
}
